package com.ruoyi.oauth.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.oauth.mapper.OauthClientMapper;
import com.ruoyi.oauth.domain.OauthClient;
import com.ruoyi.oauth.service.IOauthClientService;

/**
 * 客户端Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-01-31
 */
@Service
public class OauthClientServiceImpl implements IOauthClientService 
{
    @Autowired
    private OauthClientMapper oauthClientMapper;

    /**
     * 查询客户端
     * 
     * @param clientId 客户端主键
     * @return 客户端
     */
    @Override
    public OauthClient selectOauthClientByClientId(String clientId)
    {
        return oauthClientMapper.selectOauthClientByClientId(clientId);
    }

    /**
     * 查询客户端列表
     * 
     * @param oauthClient 客户端
     * @return 客户端
     */
    @Override
    public List<OauthClient> selectOauthClientList(OauthClient oauthClient)
    {
        return oauthClientMapper.selectOauthClientList(oauthClient);
    }

    /**
     * 新增客户端
     * 
     * @param oauthClient 客户端
     * @return 结果
     */
    @Override
    public int insertOauthClient(OauthClient oauthClient)
    {
        oauthClient.setCreateTime(DateUtils.getNowDate());
        return oauthClientMapper.insertOauthClient(oauthClient);
    }

    /**
     * 修改客户端
     * 
     * @param oauthClient 客户端
     * @return 结果
     */
    @Override
    public int updateOauthClient(OauthClient oauthClient)
    {
        oauthClient.setUpdateTime(DateUtils.getNowDate());
        return oauthClientMapper.updateOauthClient(oauthClient);
    }

    /**
     * 批量删除客户端
     * 
     * @param clientIds 需要删除的客户端主键
     * @return 结果
     */
    @Override
    public int deleteOauthClientByClientIds(String[] clientIds)
    {
        return oauthClientMapper.deleteOauthClientByClientIds(clientIds);
    }

    /**
     * 删除客户端信息
     * 
     * @param clientId 客户端主键
     * @return 结果
     */
    @Override
    public int deleteOauthClientByClientId(String clientId)
    {
        return oauthClientMapper.deleteOauthClientByClientId(clientId);
    }
}
